﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.XtraEditors.Controls;

namespace ProgNetDxComponents.Design.Editors
{
    public class RadioItemValueEditor : ProgNetComponents.Design.Editors.BaseListEditor
    {
        protected override Dictionary<string, object> GetListBoxItems()
        {
            Dictionary<string, object> l = new Dictionary<string, object>();
            if (this._Context != null && this._Context.Instance != null)
            {
                RadioGroupItemCollection coll = this._Context.Instance.GetFieldValue("Collection") as RadioGroupItemCollection;
                if (coll != null)
                {
                    foreach (RadioGroupItem i in coll)
                    {
                        if (!l.ContainsKey(i.Value.AsString()))
                        {
                            l.Add(i.Value.AsString(), i.Value);
                        }
                    }
                }
            }
            return l;
        }

    }
}
